<template>
<div class="navihead" :style="{background:bg,color:color}">
    <img v-if="back" class="back" src="../assets/back.png" @click="backs()" alt="">
    <div v-else class="back"></div>
    <span>{{title}}</span>
    
    <slot name="right"><div class="back"></div></slot>
</div>
</template>
<script>
export default {
    props:{
        title:{
            type:String,
            default:""
        },
        back:{
            type:String,
            default:""
        },
        bg:{
            default:"#fff"
        },
        color:{
            default:"#000"
        },
        fn:{
            
        }
    },
    data(){
        return{
            back:this.back
        }
    },
    methods:{
        backs(){
            if(this.fn){
                this.fn()
            }else{
                this.$router.go(-1)
            }
        }
    }
}
</script>
<style lang='less' scoped>
.navihead{
  position: sticky;
  top: 0rem;
  background: #FFFFFF;
  box-sizing: border-box;
  width: 100%;
  height: 98rem;
  padding: 15rem 30rem 0 ;
  display:flex ;
  justify-content: space-between;
  align-items: center;
  .back{
    width: 36rem;
    height: 36rem;
  }
  span{
    font-size: 36rem;
    font-family: PingFang SC;
    font-weight: bold;
    color: #303133;
  }
}
</style>